
package com.java_base.loop;

import java.util.Scanner;

public class DeadForDemo {
    public static void main(String[] args) {
        // 目标：学会定义死循环
/*        for ( ; ; ) {
            System.out.println("你好！世界");
        }*/
        // 经典写法
/*        while (true){
            System.out.println("我是快乐的死循环！");
        }*/
/*        do {
            System.out.println("我是快乐的死循环！");
        }while (true);*/
        int okPas = 520;
        Scanner sc = new Scanner(System.in);
        while (true){
            System.out.print("请输入密码：");
            int password = sc.nextInt();
            if (password == okPas){
                System.out.println("登录成功！");
                break;
            }else {
                System.out.println("密码错误");
            }
            System.out.println("----------------------------------------");
        }
    }

}
